package login;

import hibernate.HibernateUtil;

import org.apache.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import entity.UserVo;


public class UserDao extends HibernateUtil{

	
	static Logger logger = Logger.getLogger(UserDao.class);
	
	private final SessionFactory sessionFactory = getSessionFactory();


	public void attachDirty(UserVo instance) {
		logger.debug("attaching dirty ApplyAgent instance");
		try {
			Session session=sessionFactory.getCurrentSession();
			session.beginTransaction();
			session.saveOrUpdate(instance);
			session.getTransaction().commit();
			logger.debug("attach successful");
		} catch (RuntimeException re) {
			logger.error("attach failed", re);
			throw re;
		}
	}


}
